<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>AngelScript: string object</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">AngelScript
   
   </div>
   
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('doc_addon_std_string.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">string object </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p><b>Path:</b> /sdk/add_on/scriptstdstring/</p>
<p>This add-on registers the <code>std::string</code> type as-is with AngelScript. This gives perfect compatibility with C++ functions that use <code>std::string</code> in parameters or as return type.</p>
<p>A potential drawback is that the <code>std::string</code> type is a value type, thus may increase the number of copies taken when string values are being passed around in the script code. However, this is most likely only a problem for scripts that perform a lot of string operations.</p>
<p>Register the type with <code>RegisterStdString(asIScriptEngine*)</code>. Register the optional split method and global join function with <code>RegisterStdStringUtils(asIScriptEngine*)</code>. The optional functions require that the <a class="el" href="doc_addon_array.html">array template object</a> has been registered first.</p>
<h2><a class="anchor" id="doc_addon_std_string_1"></a>
Public C++ interface</h2>
<p>Refer to the <code>std::string</code> implementation for your compiler.</p>
<h2><a class="anchor" id="doc_addon_std_string_2"></a>
Public script interface</h2>
<pre>
  class string
  {
    // Constructors
    string();
    string(const string &amp;in);</pre><pre>    // Property accessor for getting and setting the length
    uint length { get const; set; }</pre><pre>    // Methods for getting and setting the length
    uint length() const;
    void resize(uint);</pre><pre>    // Assignment and concatenation
    string &amp;opAssign(const string &amp;in other);
    string &amp;opAddAssign(const string &amp;in other);
    string  opAdd(const string &amp;in right) const;</pre><pre>    // Access individual characters
    uint8       &amp;opIndex(uint);
    const uint8 &amp;opIndex(uint) const;</pre><pre>    // Comparison operators
    bool opEquals(const string &amp;in right) const;
    int  opCmp(const string &amp;in right) const;</pre><pre>    // Substring
    string substr(uint start = 0, int count = -1) const;
    array&lt;string&gt;@ split(const string &amp;in delimiter) const;</pre><pre>    // Search
    int findFirst(const string &amp;in str, uint start = 0) const;
    int findLast(const string &amp;in str, int start = -1) const;</pre><pre>    // Automatic conversion from primitive types to string type
    string &amp;opAssign(double val);
    string &amp;opAddAssign(double val);
    string  opAdd(double val) const;
    string  opAdd_r(double val) const;</pre><pre>    string &amp;opAssign(int val);
    string &amp;opAddAssign(int val);
    string  opAdd(int val) const;
    string  opAdd_r(int val) const;</pre><pre>    string &amp;opAssign(uint val);
    string &amp;opAddAssign(uint val);
    string  opAdd(uint val) const;
    string  opAdd_r(uint val) const;</pre><pre>    string &amp;opAssign(bool val);
    string &amp;opAddAssign(bool val);
    string  opAdd(bool val) const;
    string  opAdd_r(bool val) const;
  }</pre><pre>  // Takes an array of strings and joins them into one string separated by the specified delimiter
  string join(const array&lt;string&gt; &amp;in arr, const string &amp;in delimiter);</pre><pre>  // Formatting numbers into strings
  // The options should be informed as characters in a string
  //  l = left justify
  //  0 = pad with zeroes
  //  + = always include the sign, even if positive
  //    = add a space in case of positive number
  //  h = hexadecimal integer small letters
  //  H = hexadecimal integer capital letters
  //  e = exponent character with small e
  //  E = exponent character with capital E
  string formatInt(int64 val, const string &amp;in options, uint width = 0);
  string formatFloat(double val, const string &amp;in options, uint width = 0, uint precision = 0);</pre><pre>  // Parsing numbers from strings
  int64  parseInt(const string &amp;in, uint base = 10, uint &amp;out byteCount = 0);
  double parseFloat(const string &amp;in, uint &amp;out byteCount = 0);</pre><pre></pre> </div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>

    <li class="footer">Generated on Sun Jan 29 2012 15:41:03 for AngelScript by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
